Skip to content

fix(ptodsl): correct With slot liveness - #1340

Merged
mouliangyu merged 1 commit into
hw-native-sys:mainfrom
mouliangyu:codex/tilekernels-vmi-perf-cast-layouts
Aug 27, 2026
Merged

fix(ptodsl): correct With slot liveness#1340
mouliangyu merged 1 commit into
hw-native-sys:mainfrom
mouliangyu:codex/tilekernels-vmi-perf-cast-layouts

Conversation

@Zhendong404

@Zhendong404 Zhendong404 commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR keeps the two changes from tilekernels-vmi-perf that are still in scope, rebased onto the current main:

  • Fix contiguous lowering for compact GS8 loads.
  • Fix PTODSL slot liveness across With/AsyncWith statements, with regression coverage.

The previously included fp8/f16 deinterleaved cast-layout commit has been removed because that issue is being handled separately. No byte-widening vgather changes are included; those overlap with PTOAS PR #1315.

Validation

  • ninja -C build pto-test-opt
  • llvm-lit -v build/test/lit/vmi_new/vmi_to_vpto_group_slot_load.pto — PASS
  • PYTHONPATH=build/python:$PYTHONPATH .venv/bin/python ptodsl/tests/test_jit_compile.py — PASS
  • llvm-lit -q build/test/lit/vmi_new — 514/526 passed; 12 remaining failures are in existing group-slot/optimization paths.

@Zhendong404
Zhendong404 force-pushed the codex/tilekernels-vmi-perf-cast-layouts branch from 3b5bbc9 to 87c8f9a Compare August 25, 2026 06:23
@Zhendong404 Zhendong404 changed the title feat(vmi): preserve assigned cast layouts fix(vmi,ptodsl): correct GS8 lowering and With slot liveness Aug 25, 2026

@mouliangyu mouliangyu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

发现两个需要在合入前处理的问题:GS8 的普通 vlds 会把 compact load 的实际读取范围扩大到完整 vector footprint;With/AsyncWith 的 slot liveness 对多 context item 的绑定顺序处理不正确。

验证:LLVM 19.1.7 下重建 pto-test-opt 成功,11 个受影响的 VMI lit 用例通过;新增 PTODSL probe 可单独生成两个 scf.for。现有测试主要验证 IR 形态,未覆盖下面的内存边界和多 item with 场景。

Comment thread lib/PTO/Transforms/VMIToVPTO.cpp Outdated


def _slot_live_before_stmt(stmt, live_after, static_env, static_iters) -> set[_SubscriptSlot]:
if isinstance(stmt, (ast.With, ast.AsyncWith)):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里没有遵循 Python with item 从左到右求值、每项立即绑定 optional_vars 的语义。例如 with cm() as values, cm(values[0]): pass 中,第二项的 values[0] 不是 with 之前的 live-in,但当前实现会把它加入 context_loads,纯 AST probe 也确实返回该 slot。这可能生成未定义或多余的 loop carry。建议从 body_live 开始逆序遍历 items:先 kill 当前 optional_vars 的绑定,再加入该项 context_expr 的 loads,并覆盖 subscript 绑定目标。

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改

@Zhendong404
Zhendong404 force-pushed the codex/tilekernels-vmi-perf-cast-layouts branch 2 times, most recently from 309ad3d to d112ac0 Compare August 26, 2026 10:31
@Zhendong404 Zhendong404 changed the title fix(vmi,ptodsl): correct GS8 lowering and With slot liveness fix(ptodsl): correct With slot liveness Aug 27, 2026
@Zhendong404
Zhendong404 force-pushed the codex/tilekernels-vmi-perf-cast-layouts branch from d112ac0 to 86b7744 Compare August 27, 2026 06:16

@mouliangyu mouliangyu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

复审通过。先前两条阻塞意见均已处理:GS8/VMI 改动已移除;With/AsyncWith 的 slot liveness 已按 with-item 的求值与绑定顺序修正,并补充了聚焦回归测试。CI 全绿。

@mouliangyu
mouliangyu merged commit 80ac6d0 into hw-native-sys:main Aug 27, 2026
14 of 15 checks passed
@mouliangyu
mouliangyu deleted the codex/tilekernels-vmi-perf-cast-layouts branch August 27, 2026 08:20
@reedhecre

Copy link
Copy Markdown

A3 板测失败

  • 触发方式:merged
  • 源码提交:80ac6d0488a4
  • 结果汇总:OK 317 / FAIL 6 / SKIP 29
  • 日志:/home/zhongxuan/ptoas-board-monitor/runtime/logs/20260827_015852_merged_pr1340.log
  • 结果 TSV:/home/zhongxuan/ptoas-board-monitor/runtime/logs/20260827_015852_merged_pr1340.tsv
  • 失败阶段:board-validation / exit=1

失败用例

  • DeepseekV4DecodeA3/qk_pv (run, exit=1)
  • DeepseekV4DecodeA3/gate (run, exit=1)
  • DeepseekV4DecodeA3/score (run, exit=1)
  • Qwen3_14BPrefillA3/qk_pv_online_phase (run, exit=1)
  • Qwen3_14BPrefillA3/qk_pv_skew_probe (run, exit=1)
  • Movfp/movfp_fixpipe_reuse_a3 (run, exit=1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants